#include <Length.h>
#include <LengthUnit.h>
#include <iostream>
#include <string.h>

using namespace std;


Length::Length(const Uint32 value, const LengthUnit& lengthUnit):LengthQuantity(value, lengthUnit)
{
}

ostream& Length::print(ostream& ostr, const Formatter& formatter)
{
	ostringstream ostrs;
        formatter.print(ostrs, LengthQuantity::toBase(), LengthQuantity::unitType_m);
	ostr << ostrs.str();
   	return ostr; 
}
/*
string Length::getUnitName() const
{
        //strcpy(unitName_m, unitType_m.getUnitName().c_str());
        //return unitName_m;
        return (unitType_m.getUnitName());
}

static void calcValue(Length& length_i, const LengthUnit& unit_i)
{
    Length zero(0,unit_i);
    Length quotient = length_i / unit_i;
    Length compliment = length_i % unit_i;

    if (quotient != zero)
      ostream_i << quotient.toBase() << " " << quotient.getUnitName() << " ";

}

std::ostream& operator <<(std::ostream& ostream_i, const Length& length)
{
        Length backupLen(length);

        calcValue(backupLen,MILE);
        calcValue(backupLen,YARD);
        calcValue(backupLen,FEET);
        calcValue(backupLen,INCH);
        return ostream_i;
}

std::ostream & operator << (std::ostream & ostream_i, const Length& length)
{
    std::stringstream strstream;
    quantity.unit_m.formatOutput(strstream, quantity.amount_m);
    ostream_i << strstream.str();
    return ostream_i;
}
*/

